#include "SDKCorePrivate.h"
#include "DynTargetItemPrivate.h"

using namespace osgEarth::Annotation;

DynTargetItemPrivate::DynTargetItemPrivate(const QString& name,const QString& group,const QString& nation,const QString& type,DynTargetItemSetPrivate* set):
itemSet(set),
targetNation(nation),
targetGroup(group),
targetType(type)
{
	setName(name);
	positionNode = new GeoPositionNode(GLOBAL_OSG_MAP_NODE);
	GLOBAL_OSG_ANNO_GROUP->addChild(positionNode);
}

DynTargetItemPrivate::~DynTargetItemPrivate()
{
	GLOBAL_OSG_ANNO_GROUP->removeChild(positionNode);
}

DynTargetItemTrack* DynTargetItemPrivate::track()const
{
	return nullptr;
}

bool DynTargetItemPrivate::isAirplane() const
{
	return targetType == "fly";
}

bool DynTargetItemPrivate::isShip() const
{
	return targetType == "overwater";
}

QString DynTargetItemPrivate::getNation() const
{
	return targetNation;
}

QString DynTargetItemPrivate::getGroupName() const
{
	return targetGroup;
}

bool DynTargetItemPrivate::appendTrack(double lon,double lat,double alt,quint64 time,double head)
{
	return true;
}

void DynTargetItemPrivate::setColor(const QString& color)
{
	targetColor = color;
}

void DynTargetItemPrivate::setTrackColor(const QString& color)
{
	trackColor = color;
}

bool DynTargetItemPrivate::isContains(double x,double y)
{
	return false;
}

DynTargetItemSet* DynTargetItemPrivate::getDynTargetSet() const
{
	return itemSet;
}
	
HistoryTrackLine* DynTargetItemPrivate::getHistoryTrackLine()const
{
	return nullptr;
}

void DynTargetItemPrivate::dirty()
{
}

void DynTargetItemPrivate::setVisible(bool visible)
{
	positionNode->setNodeMask(visible ? 1 : 0);
}

bool DynTargetItemPrivate::isVisible()const
{
	return positionNode->getNodeMask() == 0 ? true : false;
}

QString DynTargetItemPrivate::getItemType()const
{
	return targetType;
}

